<HTML><HEAD><TITLE>join_string(++List, +Glue, -String)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Strings and Atoms</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>join_string(++List, +Glue, -String)</H1>
String is the string formed by concatenating the elements of List with
an instance of Glue beween each of them.


<DL>
<DT><EM>List</EM></DT>
<DD>List of atomic terms.
</DD>
<DT><EM>Glue</EM></DT>
<DD>A string or atom.
</DD>
<DT><EM>String</EM></DT>
<DD>A string or variable.
</DD>
</DL>
<H2>Description</H2>
   String is the string formed by concatenating the elements of List
   with an instance of Glue beween each of them.  List may contain
   numbers, atoms and strings.  The result of the concatenation is
   always a string.

<P>
   Note that concat_string/2 can be defined as

<P>
<PRE>
       concat_string(List, String) :-
	    join_string(List, "", String).
</PRE>

<H3>Modes and Determinism</H3><UL>
<LI>join_string(++, +, -) is det
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>List is not instantiated (non-coroutine mode only).
<DT><EM>(4) instantiation fault </EM>
<DD>List contains free variables (non-coroutine mode only).
<DT><EM>(5) type error </EM>
<DD>List is instantiated, but not to a list of atomic terms.
<DT><EM>(5) type error </EM>
<DD>String is neither an string nor a variable.
<DT><EM>(5) type error </EM>
<DD>Glue is neither an string nor an atom.
</DL>
<H2>Examples</H2>
<PRE>
Success:
    join_string([usr,"local",bin], "/", "usr/local/bin").
    join_string([1,2,3], " -&gt; ", "1 -&gt; 2 -&gt; 3").

Error:
    join_string(A,"-",X).        (Error 4).
    join_string([abc,D],",",X).  (Error 4).
    join_string(art,",",X).      (Error 5).
    join_string([a,b],3,X).      (Error 5).



</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/stratom/concat_string-2.html">concat_string / 2</A>, <A HREF="../../kernel/stratom/concat_strings-3.html">concat_strings / 3</A>, <A HREF="../../kernel/stratom/append_strings-3.html">append_strings / 3</A>, <A HREF="../../kernel/stratom/atom_string-2.html">atom_string / 2</A>, <A HREF="../../kernel/stratom/split_string-4.html">split_string / 4</A>, <A HREF="../../kernel/ioterm/sprintf-3.html">sprintf / 3</A>
</BODY></HTML>
